<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扫码登录</title>
    <style>
        body {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
            flex-direction: column;
        }
        .qrcode {
            width: 200px;
            height: 200px;
        }
    </style>
</head>
<body>
    <h3>请使用QQ扫码</h3>
    <img class="qrcode" src="data:image/jpeg;base64,{$qrcode}" />
</body>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<script>
    var qrsig = "{$qrsig}";
    var url = '/plugin/qrcode_login/index/listenQq?qrsig=' + qrsig;
    $(document).ready(function () {
        setInterval(function () {
            $.ajax({type:"GET",url:url,success:function (res) {
                if(res.msg == '登录成功') {
                    window.location.href = document.referrer; //返回上一页并刷新
                }
                if(res.msg == '二维码已失效') {
                    window.location.reload();
                }
                if(res.msg == '正在验证二维码') {
                    document.getElementsByTagName("h3")[0].innerHTML = '正在进行登录验证'
                }
            }});
        },2000);
    });
</script>
</html>